<?php
require("./database/inc_OnlineStoreDB.php");
	function user_data($customerID){
		$DBConnect = @mysql_connect("localhost", "root","");

			if ($DBConnect === FALSE){
				echo "<p>Unable to connect to the database server. " .
					"Error code " . mysql_errno() . ": " .
					mysql_error() . "</p>\n";
					++$errors;
			}
			else{
				$DBName = "online_stores";
				$result = @mysql_select_db($DBName, $DBConnect);

				if ($result === FALSE){
					echo "<p>Unable to select the database. " .
					"Error code " . mysql_errno($DBConnect) .
					": " . mysql_error($DBConnect) .
					"</p>\n";
					++$errors;
				}
			}

				$data = array();
				$customerID = (int)$customerID;

				$func_num_args = func_num_args();
				$func_get_args = func_get_args();

				

				if($func_num_args > 1){
					unset($func_get_args[0]);

					$fields = '`'.implode('`, `', $func_get_args).'`';
					//echo "SELECT '$fields' FROM `customer` WHERE `customerID` = $customerID";
					//die(mysql_error());
					$data = mysql_fetch_assoc(mysql_query("SELECT $fields FROM `customer` WHERE `customerID` = $customerID"));

					//print_r($data);
					//die(mysql_error());
					return $data;				
				}
							

			}

			function logged_in(){
				return (isset($_SESSION['customerID'])) ? TRUE : FALSE;
			}	
?>